home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / PASCAL / 0195.ZIP / MKRMDIR.LIB < prev    next >
Text File  |  1984-12-17  |  2KB  |  46 lines

  1. {@@@@@@@@@@@ copyright (C) 1984 by Neil J. Rubenking @@@@@@@@@@@@@@@@@@@@@@@@
  2. The purchaser of these procedures and functions may include them in COMPILED
  3. programs freely, but may not sell or give away the source text.
  4.  
  5.        Make or remove a directory.  Input is a full path name,
  6.        including the drive, and "M" for Make or "R" for Remove.
  7.        A one-byte error code is returned.  You cannot remove the
  8.        current director.  If you try to remove a non-empty
  9.        directory, you'll get error code 5, "access denied".
  10.  
  11.        NOTE that any program that INCLUDEs this file MUST also include the
  12.        type declarations contained in REGPACK.TYP and FILENAME.TYP,
  13.        and may want to include ERRMESSG.LIB
  14. }
  15. {@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}
  16. procedure DoSubDirectory(activity : char ;
  17.                       VAR filename : filename_type;
  18.                       VAR error    : byte);
  19.  
  20. var
  21.   registers : regpack;
  22. begin
  23.   filename[length(filename)+1] := #0;
  24.   with registers do
  25.     begin
  26.       DS := seg(filename);
  27.       DX := ofs(filename)+1;
  28.       case UpCase(activity) of
  29.         'M': AX := $39 shl 8;
  30.         'R': AX := $3A shl 8;
  31.       end;
  32.       if UpCase(activity) in ['M','R'] then
  33.         begin
  34.           MSDOS(registers);
  35.           if flags and 1 = 1 then
  36.             error := AX and $00FF
  37.           else error := 0;
  38.         end
  39.       else
  40.         begin
  41.           WriteLn('Program error--input to "DoSubDirectory" must by M or R.');
  42.           halt;
  43.         end;
  44.     end; {with}
  45. end;
  46.